#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
const int K = 100005, N = 105, P = 15;
int n, k, p, cnt;
queue <int> q;
priority_queue<int> ans;
void check () {
	int y = q.front();
	q.pop();
	q.push(y);
}
int main () {
	scanf ("%d%d%d", &n, &k, &p);
	for (int i = 1; i <= k; i++) {
		q.push(i);
	}
	while (!q.empty()) {
		int x = q.front();
		q.pop();
		for (int i = 1; i <= p; i++) {
			check();
		}
		cnt++;
		if (cnt == n) {
			ans.push(-x);
			cnt = 0;
		}
	}
	while(ans.size()) {
		printf("%d\n", -ans.top());
		ans.pop();
	}
	return 0;
}